package cn.vshare.controller;

import cn.vshare.entity.User;
import cn.vshare.service.FansService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class FansController {
    @Resource(name="fansServiceImpl")
    private FansService fansService;

    /**
     * 添加关注
     * @param map
     */
    @RequestMapping("addFans")
    public void addFans(@RequestParam Map map){
        fansService.addFans(map);
    }
    @RequestMapping("delFans")
    public void delFans(@RequestParam Map map){
        fansService.delFans(map);
    }

    /**
     * 查询关注的所有用户
     * @param myId
     * @return
     */
    @RequestMapping("queryAllFans")
    public List<User> queryAllFans(String myId){
        return  fansService.queryMyFans(myId);
    }

    /**
     * 判断是不是已经关注
     * @param myId
     * @param fansId
     * @return
     */
    @RequestMapping("isExistFans")
    public int  isExistFans(String myId, String fansId){
        return fansService.isExistFans(myId,fansId);
    }

   @RequestMapping("queryFocusCount")
    public int queryFocusCount(String userId) {
        return fansService.queryFocusCount(userId);
    }

   @RequestMapping("queryFansCount")
    public int queryFansCount(String userId) {
        return fansService.queryFansCount(userId);
    }


}
